package com.tangdi.Dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.tangdi.common.DBConnect;

public class SystemParameterImpl {
	Connection con=DBConnect.getInstance().getConnection();
	PreparedStatement pstmt=null;
	ResultSet rs=null;
	
	public String getPath(String name){
		String  path = "";
		String sql = "SELECT pathValue FROM SYSTEM_PARAMETER_INFO WHERE PATHNAME = '"+ name +"'";
		try{
			pstmt=con.prepareStatement(sql);
			rs=pstmt.executeQuery();
			while(rs.next()){
				path = rs.getString(1);
			}
		}catch(SQLException e){
			e.printStackTrace();
			return "";
		}finally{
			if(pstmt!=null)
				try{
					pstmt.close();
					}catch(SQLException e){
						e.printStackTrace();
						}
			}
		return path;
	}
	
	public String getIs_PrintTogetherMark(String name){
		String  path = "";
		String sql = "SELECT pathValue FROM SYSTEM_PARAMETER_INFO WHERE PATHNAME = '"+ name +"'";
		try{
			pstmt=con.prepareStatement(sql);
			rs=pstmt.executeQuery();
			while(rs.next()){
				path = rs.getString(1);
			}
		}catch(SQLException e){
			e.printStackTrace();
			return "";
		}finally{
			if(pstmt!=null)
				try{
					pstmt.close();
					}catch(SQLException e){
						e.printStackTrace();
						}
			}
		return path;
	}
}
